<%@page import="study.itwill.jsp.CookieBox"%>
<%@page import="study.itwill.team5.admin.AdminItem"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ page session="true" %>
<%
	CookieBox cbox = new CookieBox(request, response);
	String save_id = null;
	if (cbox.exists("save_id")) {
		save_id = cbox.getValue("save_id");
	}
%>
<%
	AdminItem loginInfo = (AdminItem)session.getAttribute("ADMIN_INFO");
%>
<!DOCTYPE html>
<html lang="ko">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"/>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<title>login</title>

		<!-- 모바일 웹 페이지 설정 -->
		<link rel="shortcut icon" href="assets/ico/favicon.png" />
		<link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png" />
		<link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png" />
		<link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png" />
		<link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png" />

		<!-- bootstrap -->
		<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css" />
		<!-- 나눔고딕 웹 폰트 적용 -->
		<link rel="stylesheet" type="text/css" href="assets/css/nanumfont.css" />
		<!-- 반응형 웹을 지원하지 않을 경우 -->
		<!-- <link rel="stylesheet" href="assets/css/non-responsive.css" /> -->

		<!-- IE8 이하 버전 지원 -->
		<!--[if lt IE 9]>
		<script type="text/javascript" src="assets/js/html5shiv.js"></script>
		<script type="text/javascript" src="assets/js/respond.min.js"></script>
		<![endif]-->

		<!-- IE10 반응형 웹 버그 보완 -->
		<!--[if gt IE 9]>
		<link rel="stylesheet" type="text/css" href="assets/css/ie10.css" />
		<script type="text/javascript" src="assets/js/ie10.js"></script>
		<![endif]-->
		<style type="text/css">
			html, body {
				width: 100%;
				height: 100%;
			}
			
			body {
				padding-top : 40px;
				padding-bottom : 40px;
				background: #eee url('admin/login_bg.jpg') no-repeat center center;
				background-size: cover;
			}
			
			.form-signin {
				max-width: 330px;
				padding: 15px;
				margin: auto auto;
			}
			
			.form-signin h2, .form-signin .checkbox {
				margin-bottom: 10px;
				color: #eee;
				text-shadow: 0 1px 1px #000;
			}
			
			.form-signin .checkbox {
				font-weight: normal;
			}
			
			.form-signin .form-control {
				position: relative;
				font-size: 16px;
				height: auto;
				padding: 10px;
				-webkit-box-sizing: border-box;
				-moz-box-sizing: border-box;
				box-sizing: border-box;
			}
			
			.form-signin .form-control:focus {
				z-index: 2;
			}
			
			.form-signin input[type="text"] {
				margin-bottom: -1px;
				border-bottom-left-radius: 0;
				border-bottom-right-radius: 0;
			}
			
			.form-signin input[type="password"] {
				margin-bottom: 10px;
				border-bottom-left-radius: 0;
				border-bottom-right-radius: 0;
			}
			
			.form-signin .col-sm-6 {
				padding-top: 5px !important;
			}
			@media (min-width: 768px) {
				.form-signin .col-sm-6:first-child {
					padding-right: 5px !important;
				}
				
				.form-signin .col-sm-6:last-child {
					padding-left: 5px !important;				
				}
			}
		</style>
	</head>

	<body>
	
		<div class="container">
			<form name="form1" class="form-signin" role="form" method="post" action="loginOk.jsp">
				<h2>로그인이 필요합니다.</h2>
				<input type="text" id="user_id" name="user_id" class="form-control" placeholder="아이디를 입력하세요." <% if (save_id != null) { %>value="<%=save_id%>"<% } %> <% if (save_id == null) { %>autofocus<% } %>>
				<input type="password" id="user_pw" name="user_pw" class="form-control" placeholder="비밀번호를 입력하세요." <% if (save_id != null) { %>autofocus<% } %>>
				<label class="checkbox">
					<input type="checkbox" name="save_id" value="Y" <% if (save_id != null) { %>checked<% } %>/>
				아이디 저장기능 사용 </label>
				<button class="btn btn-lg btn-primary btn-block" type="submit">
					로그인
				</button>
			</form>
		</div>
		
		<!-- Javascript -->
		<script src="assets/js/jquery.js"></script>
		<script src="assets/js/bootstrap.min.js"></script>
		<script src="assets/js/string.js"></script>
		<script type="text/javascript">
		$(function() {
			$("form[name='form1']").submit(function() {
				if (!$("#user_id").val().isValue()) {
					alert("아이디를 입력하세요.");
					$("#user_id").focus();
					return false;
				}
				
				if (!$("#user_pw").val().isValue()) {
					alert("비밀번호를 입력하세요.");
					$("#user_pw").focus();
					return false;
				}
			});
		});
	</script>
		
	</body>
</html>